import axios from '@/libs/api.request'
import { getToken } from '@/libs/util'
// =============== news-system/advertisements/list.vue =========================
let auth_token = getToken();
//订单
export const getTableData = (page_current, page_size, searchData) => {
  return axios.request({
    url: 'api/v1.cuser.order/index',
    params: {
      page_current: page_current,
      page_size: page_size,
      auth_token:auth_token,
      order_status :searchData.order_status,
    },
    method: 'get'
  })
}

//订单详情
export const getInfo = (order_id) => {
  return axios.request({
    url: 'api/v1.cuser.order/read',
    params: {
      order_id: order_id,
      auth_token:auth_token,
    },
    method: 'get'
  })
}

//租金明细
export const getZprice = (order_id) => {
  return axios.request({
    url: 'api/v1.cuser.order/z_price_read',
    params: {
      order_id: order_id,
      auth_token:auth_token,
    },
    method: 'get'
  })
}

//还车详情
export const getCarBackInfo = (order_id,back_car_type) => {
  return axios.request({
    url: 'api/v1.cuser.order/back_car_read',
    params: {
      order_id: order_id,
      back_car_type:back_car_type,
      auth_token:auth_token,
    },
    method: 'get'
  })
}

//结束订单
export const endOrder = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.order/end_order',
    data:formData,
    method: 'post'
  })
}

//还车
export const backCar = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.order/back_car',
    data:formData,
    method: 'post'
  })
}

//筛选数据
export const getData = () => {
  return axios.request({
    url: 'api/v1.cuser.index/get_data',
    params: {
      auth_token:auth_token,
    },
    method: 'get'
  })
}
